package com.zwl.sjzmanagement.controller;

import com.atguigu.tingshu.common.result.Result;
import com.zwl.model.LoginInfo;
import com.zwl.model.UserInfo;
import com.zwl.sjzmanagement.service.UserInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/user")
@Slf4j
public class WxLoginApiController {

    @Autowired
    private UserInfoService userInfoService;

    @Autowired
    private StringRedisTemplate redisTemplate;


    @PostMapping("/Login")
    public Result Login(@RequestBody UserInfo userInfo) {

        LoginInfo  loginInfo = userInfoService.Login(userInfo);

        if(loginInfo != null){
            return Result.ok(loginInfo);
        }
        return Result.fail("用户名或密码错误!");
    }





}
